/**
 * @Author: Sagan
 * @Date: 2020/12/29 23:55
 */
package arr

func Sum(a []int) int64 {
	if 1 > len(a) {
		return 0
	}
	if 2 > len(a) {
		return int64(a[0])
	}
	var result int64
	for _, v := range a {
		result += int64(v)
	}
	return result
}

func SumInt64(a []int64) int64 {
	if 1 > len(a) {
		return 0
	}
	if 2 > len(a) {
		return a[0]
	}
	var result int64
	for _, v := range a {
		result += v
	}
	return result
}
